package demo7;

class Outclass4 {
    public void test1() {
        System.out.println("test1");
    }
}

interface OutInterface {
    void test2();
}
public class Test4 {
    public static void main(String[] args) {
        OutInterface outInterface = new OutInterface() {
            @Override
            public void test2() {
                System.out.println("test2");
            }
        };
        outInterface.test2();
    }
    public static void main1(String[] args) {
        //匿名内部类,当实现类时不能创建对象
//        Outclass4 outclass4 = new Outclass4(){
//
//        }.test1();
        new Outclass4(){

        }.test1();
    }
}
